<!DOCTYPE html>
<html>
<head>
	<title>MBean Index</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="${rootPath}/static/css/bootstrap.min.css"/>
</head>
<body>
<div class="container theme-showcase" role="main">
    <!-- Main jumbotron for a primary marketing message or call to action -->
    <div class="jumbotron">
      <h1>About this Application</h1>
      <em>contextId: </em><span>${contextId}</span>
      <ul class="list-unstyled">
	      <!--<li><a href="bean/springApplication"><i>springApplication</i></a> when spring.registerApplication is true</li>-->
	      <li><a href="${rootPath}/bean/applicationContext"><i>applicationContext</i></a> when spring.registerApplicationContext is true</li>
	      <!--<li><a href="${rootPath}/bean/dispatcherServlet"><i>dispatcherServlet</i></a> default dispatcherServlet</li>-->
      </ul>
    </div>

	<!-- search area -->
	<div class="container">
		<form method="get" class="form-inline beanSearchForm">
			<div class="form-group">
				<input class="form-control" type="text" name="beanName" placeholder="bean name" style="width: 500px;"/>
			</div>
			<input class="btn btn-default" type="submit" value="Search"/>
		</form>
	</div>
	
	<div class="panel panel-default">
	    <div class="panel-heading">
	        Show Common Beans
	    </div>
	    <div class="panel-body">
            <p class="bg-info">
                <a href="${rootPath}/bean/beansService/property/additionalTypeList">Show More Type</a> ||
                <a href="${rootPath}/bean/beansService/method/clearAllCache">Clear Cache.</a>
            </p>
		    <select id="typesSelect">
		        <option v-for="(v,k) in types" :value="v">{{k}}</option>
		    </select>
	    </div>
	    <div id="subtypsArea">
	    	<ul>
				<li v-for="item in beansOfType">
					<a :href="'${rootPath}/bean/' + item">{{item}}</a>
				</li>
			</ul>
	    </div>
	</div>
</div>
</body>
<script type="text/javascript" src="${rootPath}/static/js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="${rootPath}/static/js/vue.js"></script>
<script>

var searchUrlPrefix = "${rootPath}/search/";
var state = {
    types: ${types},
    beansOfType: ${beansOfType}
}
new Vue({
	el: '#typesSelect',
	data: state
});

new Vue({
	el: '#subtypsArea',
    data: state
});
$('.beanSearchForm').submit(function (e) {
    var beanNameLike = $('.beanSearchForm input[name=beanName]').val();
    if (!beanNameLike) return;
    window.location.href = searchUrlPrefix + beanNameLike;
	return false;
})
</script>
</html>